/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import chrriis.dj.nativeswing.swtimpl.components.JWebBrowser;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import javax.swing.BorderFactory;
import javax.swing.JPanel;

/**
 * @author Christopher Deckers
 */
public class DjWeb extends JPanel {

  public DjWeb(String location) {
    super(new BorderLayout());
    JPanel webBrowserPanel = new JPanel(new BorderLayout());
    webBrowserPanel.setBorder(BorderFactory.createTitledBorder("RatRoid Device Location"));
    final JWebBrowser webBrowser = new JWebBrowser();
    Dimension dim = this.getSize();
    System.out.println(dim.width+" "+dim.height);
    webBrowser.setHTMLContent("<iframe width=\"730\" height=\"420\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\" src=\"https://maps.google.com/maps?q="+location+"&amp;hl=fr&amp;sll=37.0625,-95.677068&amp;sspn=42.224734,86.572266&amp;t=m&amp;ie=UTF8&amp;z=14&amp;ll="+location+"&amp;output=embed\"></iframe><br /><small><a href=\"https://maps.google.com/maps?q="+location+"&amp;hl=fr&amp;sll=37.0625,-95.677068&amp;sspn=42.224734,86.572266&amp;t=m&amp;ie=UTF8&amp;z=14&amp;ll="+location+"&amp;source=embed\" style=\"color:#0000FF;text-align:left\">Agrandir le plan</a></small>");
    webBrowserPanel.add(webBrowser, BorderLayout.CENTER);
    add(webBrowserPanel, BorderLayout.CENTER);
    // Create an additional bar allowing to show/hide the menu bar of the web browser.
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 4, 4));
    webBrowser.setMenuBarVisible(false);
    add(buttonPanel, BorderLayout.SOUTH);
  }

}